extern "C"
{
#include <sys/ipc.h>
#include <errno.h>
#include <semaphore.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdio.h>
}
#include <iostream>
/**
 * @brief lock between processes
 * 
 */
class plock
{
	private:
	sem_t *sem = NULL;
	std::string name;
	int lock_cnt = 0;
	public:
	plock(std::string name);

	~plock();

	int trylock();

	int trylock_for(int us);

	int unlock();
};







